package com.controller;


import com.common.utils.PageUtils;
import com.common.utils.R;
import com.entity.JudgeQuestionEntity;
import com.service.JudgeQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;

/**
 * 判断题题库表
 *
 * @author lxl
 * @email lixialang007@163.com
 * @date 2021-09-08 21:36:20
 */
@RestController
@RequestMapping("exam/judgequestion")
public class JudgeQuestionController {
    @Autowired
    private JudgeQuestionService judgeQuestionService;

    /**
     * 列表
     */
    @RequestMapping("/list")
//    @RequiresPermissions("exam:judgequestion:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = judgeQuestionService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
//   @RequiresPermissions("exam:judgequestion:info")
    public R info(@PathVariable("id") Integer id){
		JudgeQuestionEntity judgeQuestion = judgeQuestionService.getById(id);

        return R.ok().put("judgeQuestion", judgeQuestion);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
//  @RequiresPermissions("exam:judgequestion:save")
    public R save(@RequestBody JudgeQuestionEntity judgeQuestion){
		judgeQuestionService.save(judgeQuestion);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
//    @RequiresPermissions("exam:judgequestion:update")
    public R update(@RequestBody JudgeQuestionEntity judgeQuestion){
		judgeQuestionService.updateById(judgeQuestion);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
//    @RequiresPermissions("exam:judgequestion:delete")
    public R delete(@RequestBody Integer[] ids){
		judgeQuestionService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
